package hk.m4s.lr.repair.test.ui.adapter.holder;

import android.widget.ImageView;
import android.widget.TextView;

import com.bumptech.glide.Glide;

import hk.m4s.lr.repair.test.R;
import hk.m4s.lr.repair.test.model.SearchDetail;
import hk.m4s.lr.repair.test.ui.adapter.base.ViewHolderImpl;

/**
 * Created by
 */

public class SearchGoodsHolder extends ViewHolderImpl<SearchDetail> {

    private ImageView mIvCover;
    private TextView mTvName;
    private TextView order_shop_price;
    private TextView order_shop_sale;
    private TextView order_shop_en;
    private TextView order_goods_en;
    @Override
    public void initView() {
        mIvCover = findById(R.id.order_shop_img);
        mTvName = findById(R.id.car_shop_name);
        order_shop_price = findById(R.id.order_shop_price);
        order_shop_sale= findById(R.id.order_shop_sale);
        order_shop_en= findById(R.id.order_shop_en);
        order_goods_en= findById(R.id.order_goods_en);
    }

    @Override
    public void onBind(SearchDetail data, int pos) {
        //显示图片

            Glide.with(getContext())
                    .load(data.getImgUrl())
                    .placeholder(R.mipmap.device_list_no_img)
                    .error(R.mipmap.device_list_no_img)
                    .into(mIvCover);



        mTvName.setText(data.getGoodsName());
        order_shop_sale.setText(data.getGoodsSale());
        order_shop_price.setText(data.getGoodsPrice());
        order_shop_en.setText(data.getEnNum());
        order_goods_en.setText(data.getGoodsEnNum());
    }

    @Override
    protected int getItemLayoutId() {
        return R.layout.list_item_goods_search;
    }
}
